/*
 * Middleware
 * Copyright (C) 2010/11
 * Riccardo Pulvirenti, Giuseppe Ravidà, Andrea Tino
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANDABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses
 */

#ifndef _ACTIVITY_TEST_HPP_
#define _ACTIVITY_TEST_HPP_

#include <iostream>
#include <string>

#include "activity.hpp"

namespace middleware {
//-----------------------------------------------------------------------------
// Definitions
/*!
 * Test function for Adress
 */
void ActivityTest();
//-----------------------------------------------------------------------------
// Implementations
void ActivityTest(){
	Workflow wf;
	WorkerNetwork wn;
	TaskDescriptor task1;
	TaskDescriptor task2;
	Address ad1("192.168.1.1",11111);
	Address ad2("192.168.1.2",22222);

	std::vector<Address> adrs;
	adrs.push_back(ad1);
	adrs.push_back(ad2);

	task1.set_id(10);
	task2.set_id(20);

	wf.push_back(task1);
	wf.push_back(task2);

	/*!
	 * Testing construct.
	 */
	Activity a1;
	Activity aCopy;

	/*!
	 * Testing copy construct.
	 */
	Activity a2(a1);
	aCopy = a2;

	/*!
	 * Testing Workflow iterators.
	 */
	cout << "Testing Workflow Iterators..." << std::endl;
	Workflow::TaskCollectionIterator it;
	for(it=wf.begin_workflow(); it<wf.end_workflow(); it++) {
		cout << "-" << it->get_id() << std::endl;
	}

	/*!
	 * Testing WorkerNetwork iterators.
	 */
	cout << "Testing WorkerNetwork Iterators..." << std::endl;
	WorkerNetwork::AddressCollectionIterator it;
	for(it=wn.begin_sbn(); it<wn.end_sbn(); it++) {
		cout << "-" << it->get_port() << std::endl;
	}

	//manca l'assign del workernetwork e del workflow
}
}
#endif
